#define  TEST_DEBUG 0
#if TEST_DEBUG
#include <iostream>
#include <string>
#include "rbtree.h"

using namespace std;

int main(int argc, char const *argv[]){
    QinChat::Core::RBTree<int> rbtree;
    int value;
    rbtree.Insert(41);
    
    rbtree.Insert(38);
 //   return 0;
    rbtree.Insert(31);
    
    rbtree.Insert(12);
    rbtree.Insert(19);
    rbtree.Insert(8);
    cout<<"root is: "<<rbtree.GetRoot()->data<<endl;
    cout<<"Inorder walk red black tree:"<<endl;
    rbtree.InorderWalk();
    if(rbtree.GetMinmum(value) )
        cout<<"minmum is: "<<value<<endl;
    if(rbtree.GetMaxmum(value) )
        cout<<"maxmum is: "<<value<<endl;
    if(rbtree.GetSuccessor(19,value) == 0)
        cout<<"19 successor is: "<<value<<endl;
    if(rbtree.GetPredecessor(19,value) == 0)
        cout<<"19 predecessor is: "<<value<<endl;
    if(rbtree.Delete(38)==0)
        cout<<"delete 38 successfully"<<endl;
    cout<<"root is: "<<rbtree.GetRoot()->data<<endl;
    cout<<"Inorder walk red black tree:"<<endl;
    rbtree.InorderWalk();

    return 0;
}
#endif
